/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 沈明月
 * Date: 2022-11-02
 * Time: 21:55
 */
public class TestThirteen {
//计算分数的值：计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值
    public static void main1(String[] args) {
        double sum = 0.0;
        double isFlg = 1;
        for (int i = 1; i <= 100; i++) {
            sum += isFlg/i;
            isFlg = -isFlg;
        }
        System.out.println(sum);
    }

}
